home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / OS / FWGraphx / SLBitmap.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  5.5 KB  |  205 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                SLBitmap.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:    (c) 1993 -1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef SLBITMAP_H
  11. #define SLBITMAP_H
  12.  
  13. #ifndef FWSTDDEF_H
  14. #include "FWStdDef.h"
  15. #endif
  16.  
  17. #ifndef SLGRDEF_H
  18. #include "SLGrDef.h"
  19. #endif
  20.  
  21. #ifndef SLPTRECT_H
  22. #include "SLPtRect.h"
  23. #endif
  24.  
  25. #ifndef SLPICTUR_H
  26. #include "SLPictur.h"
  27. #endif
  28.  
  29. #ifndef SLPALETE_H
  30. #include "SLPalete.h"
  31. #endif
  32.  
  33. #ifndef SLSTRMRW_H
  34. #include "SLStrmRW.h"
  35. #endif
  36.  
  37. //========================================================================================
  38. //    Forward Declarations
  39. //========================================================================================
  40.  
  41. class FW_OResourceFile;
  42. struct FW_SGraphicContext;
  43.  
  44. //========================================================================================
  45. // Bitmap
  46. //========================================================================================
  47.  
  48. class FW_CPrivBitmapRep;
  49. typedef FW_CPrivBitmapRep* FW_HBitmap;
  50.  
  51. // Export or Import functions for CFM-68K [sfu]
  52.  
  53. #if defined(FW_ODFLIB_IMPORT)
  54. #pragma import on
  55. #elif defined(FW_ODFLIB)
  56. #pragma export on
  57. #endif
  58.  
  59. FW_EXTERN_C_BEGIN
  60.  
  61. // Creation
  62.  
  63. FW_HBitmap            SL_API    FW_PrivBitmap_CreateFromBits(
  64.                                 short width, short height, short pixelSize, FW_Palette palette,
  65.                                 void* image, long imageSize, short rowBytes,
  66.                                 FW_PlatformError* error);
  67.  
  68. FW_HBitmap            SL_API    FW_PrivBitmap_CreateFromPlatformBitmap(
  69.                                 FW_PlatformBitmap    platformBitmap,
  70.                                 FW_PlatformError*    error);
  71.  
  72. FW_HBitmap            SL_API    FW_PrivBitmap_CreateFromResource(
  73.                                 FW_OResourceFile*    resourceFile,
  74.                                 FW_ResourceID        resID,
  75.                                 FW_PlatformError*    error);
  76.  
  77. FW_HBitmap            SL_API    FW_PrivBitmap_Copy(FW_HBitmap bitmap,
  78.                                 const FW_SRect&        srcRect,
  79.                                 FW_PlatformError*    error);
  80.  
  81. // Common operations
  82.  
  83. FW_Boolean            SL_API    FW_PrivBitmap_IsEqual(FW_HBitmap bitmap, 
  84.                                 FW_HBitmap bitmap2);
  85.  
  86. // Streaming
  87.  
  88. FW_HBitmap            SL_API    FW_PrivBitmap_Read(
  89.                                 FW_HReadableStream    stream,
  90.                                 FW_Boolean             bDIBFileHeader,
  91.                                 FW_PlatformError*     error);
  92.     
  93. void                SL_API    FW_PrivBitmap_Write(FW_HBitmap bitmap,
  94.                                 FW_HWritableStream    stream,
  95.                                 FW_Boolean             bDIBFileHeader,
  96.                                 FW_PlatformError*    error);
  97.  
  98. // Reference counting
  99.  
  100. void                SL_API    FW_PrivBitmap_Acquire(FW_HBitmap bitmap);
  101. long                SL_API    FW_PrivBitmap_GetRefCount(FW_HBitmap bitmap);
  102. void                SL_API    FW_PrivBitmap_Release(FW_HBitmap bitmap);
  103.  
  104. // Handle operations
  105.  
  106. FW_PlatformBitmap    SL_API    FW_PrivBitmap_GetPlatformBitmap(FW_HBitmap bitmap);
  107. FW_Boolean            SL_API    FW_PrivBitmap_IsPlatformBitmapOrphan(FW_HBitmap bitmap);
  108. FW_PlatformBitmap    SL_API    FW_PrivBitmap_OrphanPlatformBitmap(FW_HBitmap bitmap);
  109.     
  110. FW_PlatformError    SL_API    FW_PrivBitmap_SetPlatformBitmap(FW_HBitmap bitmap, 
  111.                                 FW_PlatformBitmap newBitmap);
  112. FW_PlatformError    SL_API    FW_PrivBitmap_AdoptPlatformBitmap(FW_HBitmap bitmap, 
  113.                                 FW_PlatformBitmap newBitmap);
  114.  
  115. // Palette
  116.     
  117. FW_Palette            SL_API    FW_PrivBitmap_GetPalette(FW_HBitmap bitmap, 
  118.                                 FW_PlatformError* error); 
  119. FW_PlatformError    SL_API    FW_PrivBitmap_SetPalette(FW_HBitmap bitmap, 
  120.                                 FW_Palette palette);
  121.  
  122. // Bitmap info
  123.  
  124. FW_PlatformError    SL_API    FW_PrivBitmap_GetBitmapInfo(FW_HBitmap     bitmap,
  125.                                 short&        width,
  126.                                 short&        height, 
  127.                                 short&        rowBytes,
  128.                                 short&        pixelSize);
  129.  
  130. void                SL_API    FW_PrivBitmap_GetBitmapBoundsGC(Environment* ev, 
  131.                                 FW_HBitmap bitmap, 
  132.                                 FW_SGraphicContext& gc, 
  133.                                 FW_SRect& bounds);
  134. void                SL_API    FW_PrivBitmap_GetBitmapBounds(FW_HBitmap bitmap, 
  135.                                 FW_SRect& bounds);
  136.  
  137. // Pixel manipulation                            
  138.  
  139. void                SL_API    FW_PrivBitmap_GetPixelColor(FW_HBitmap bitmap,
  140.                                 short horiz, short vert, FW_SColor& color);
  141. void                SL_API FW_PrivBitmap_SetPixelColor(FW_HBitmap bitmap,
  142.                                 short horiz, short vert, const FW_SColor& color);
  143.  
  144. // Changing the bitmap
  145.  
  146. FW_PlatformError    SL_API    FW_PrivBitmap_ChangeBitmap(FW_HBitmap     bitmap,
  147.                                 void*        image,
  148.                                 long        imageSize,
  149.                                 short        rowBytes,
  150.                                 short        width,
  151.                                 short        height, 
  152.                                 short        pixelSize,
  153.                                 FW_Boolean    bScale);
  154.  
  155. FW_PlatformError    SL_API FW_PrivBitmap_ChangeBitmapGeometry(FW_HBitmap     bitmap,
  156.                                 short        width,
  157.                                 short        height, 
  158.                                 short        pixelSize,
  159.                                 FW_Boolean    bScale);
  160.                                     
  161. FW_PlatformError    SL_API    FW_PrivBitmap_SetImage(FW_HBitmap bitmap, 
  162.                                 void* image, 
  163.                                 long imageSize, 
  164.                                 short rowBytes);
  165.  
  166. // Copy Pixels
  167.  
  168. FW_PlatformError    SL_API    FW_PrivBitmap_CopyPixels(FW_HBitmap    bitmapSrc, 
  169.                                 FW_HBitmap    bitmapDst,
  170.                                 FW_SRect&     boundsSrc, 
  171.                                 FW_SRect&    boundsDst);
  172.  
  173. // Macintosh specific
  174.  
  175. #ifdef FW_BUILD_MAC
  176.  
  177. // Conversion
  178.  
  179. FW_HBitmap            SL_API    FW_PrivBitmap_MacCreateFromPicture(FW_HPicture picture, 
  180.                                 FW_SColor fillColor,
  181.                                 const FW_SRect& pictPart, 
  182.                                 FW_PlatformError* error);
  183.  
  184. FW_HPicture            SL_API    FW_PrivBitmap_MacGetAsPicture(FW_HBitmap bitmap, 
  185.                                 const FW_SRect& bounds, 
  186.                                 FW_PlatformError* error);
  187.  
  188. PixMapHandle        SL_API    FW_PrivBitmap_MacLockPixels(FW_HBitmap bitmap);    // return NULL if fails
  189. FW_PlatformError    SL_API    FW_PrivBitmap_MacUnlockPixels(FW_HBitmap bitmap);
  190. FW_Boolean            SL_API    FW_PrivBitmap_MacIsPixelsLocked(FW_HBitmap bitmap);
  191.  
  192. #endif
  193.  
  194. FW_EXTERN_C_END
  195.  
  196. // For CFM-68K [sfu]
  197.  
  198. #if defined(FW_ODFLIB_IMPORT)
  199. #pragma import off
  200. #elif defined(FW_ODFLIB)
  201. #pragma export off
  202. #endif
  203.  
  204. #endif // SLBITMAP_H
  205.